<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">

    function createPerson (name, age, gender) {
        var person = new Object()
        person.name = name
        person.age = age
        person.gender = gender
        person.sayName = () => {
            console.log(name)
        }
        return person
    }

    var wukong = createPerson('悟空', '500', '男')
    wukong.sayName()

</script>

</body>
</html>
